<template>
  <div class="app-container">
    <el-row :gutter="10">
      <el-col
        v-for="(item,index) in toolList"
        :key="index"
        :span="6"
        class="mb-2"
      >
        <el-card
          style="text-align: center;"
        >
          <div @click="open(item)">
            <i :class="item.icon" class="text-lg mb-2"/>
            <div class="text-sm">{{ item.name }}</div>
          </div>
        </el-card>
      </el-col>
    </el-row>

  </div>
</template>

<script>
export default {
  name: 'Tool',
  data() {
    return {
      toolList: []
    }
  },
  created() {
    this.toolList = [
      {
        icon: 'fa fa-microchip',
        url: '/template/device/sensor/hardware/config',
        name: this.$t('template') + this.$t('device') + this.$t('sensor') + this.$t('hardware') + this.$t('config')
      },
      {
        icon: 'fa fa-exclamation-circle',
        url: '/device/warn/logic/config',
        name: this.$t('device') + this.$t('warn') + this.$t('config')
      },
      {
        icon: 'fa fa-print',
        url: '/iot/now',
        name: this.$t('iot') + this.$t('now')
      },
      {
        icon: 'fa fa-history',
        url: '/iot/history',
        name: this.$t('iot') + this.$t('history')
      },
      {
        icon: 'fa fa-chain-broken',
        url: '/iot/out-of-contact',
        name: this.$t('outOfRange') + this.$t('device')
      },
      {
        icon: 'fa fa-map-marker',
        url: '/iot/local',
        name: this.$t('local') + this.$t('tool')
      },
      {
        icon: 'fa fa-code',
        url: '/iot/codec',
        name: this.$t('codec')
      },
      {
        icon: 'fa fa-server',
        url: '/device-server',
        name: this.$t('server')
      },
      {
        icon: 'fa fa-exclamation-triangle',
        url: '/device/warn_upload',
        name: this.$t('device') + this.$t('warn') + this.$t('upload')
      }
    ]
  },
  methods: {
    open(item) {
      this.$router.push({
        path: item.url
      })
    }
  }
}
</script>

